package com.world.rickcloudendpoint.common.exception;

import java.util.Objects;

/**
 * ErrorInfo
 */

public class ErrorInfo {

    /**
     * 错误描述
     *
     * @return message
     **/
    private String message = null;

    /**
     * 错误码，详情请参见<<错误码表.doc>>
     *
     * @return code
     **/
    private Integer code = null;

    public ErrorInfo message(String message) {
        this.message = message;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public ErrorInfo code(Integer code) {
        this.code = code;
        return this;
    }

    /**
     * 错误码，详情请参见<<错误码表.doc>>
     *
     * @return code
     **/
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ErrorInfo errorInfo = (ErrorInfo) o;
        return Objects.equals(this.message, errorInfo.message)
                && Objects.equals(this.code, errorInfo.code);
    }

    @Override
    public int hashCode() {
        return Objects.hash(message, code);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ErrorInfo {\n");

        sb.append("    message: ").append(toIndentedString(message)).append("\n");
        sb.append("    code: ").append(toIndentedString(code)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces (except the first line).
     */
    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}
